package com.zhiyou.app.controller;


import cn.dev33.satoken.annotation.SaIgnore;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.binarywang.wxpay.bean.result.WxPayUnifiedOrderV3Result;
import com.github.pagehelper.PageInfo;
import com.zhiyou.app.common.util.IPUtil;
import com.zhiyou.app.common.vo.resp.Response;
import com.zhiyou.app.pojo.entity.OrderEntity;
import com.zhiyou.app.pojo.vo.CreateOrderResponseVo;
import com.zhiyou.app.pojo.vo.OrderCreateRequestVo;
import com.zhiyou.app.pojo.vo.OrderQueryRequestVo;
import com.zhiyou.app.pojo.vo.OrderQueryResponseVo;
import com.zhiyou.app.service.IOrderService;
import com.zhiyou.app.service.WechatService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author jonathan.z
 * @since 2025-07-03
 */
@Slf4j
@RestController
@RequestMapping("/wx")
@Api(tags = "微信回调")
public class WechatCallbackController {
    @Resource
    private WechatService wechatService;

    @ApiOperation(value = "微信回调")
    @SaIgnore
    @PostMapping("/wxNotify")
    public String wxPayNotify(HttpServletRequest request) {
        return wechatService.notify(request);
    }

    @ApiOperation(value = "微信小程序消息回调")
    @SaIgnore
    @RequestMapping(value = "/wxMaNotify", method = {RequestMethod.GET, RequestMethod.POST})
    public String wxMaNotify(HttpServletRequest request) {
        return wechatService.notifyMa(request);
    }
}
